# -*- coding:utf-8 -*-
class ImageManager:
    def __init__(self):
        self.new_images = set()
        self.old_images = set()

    # def add_item(self, data):
    #     self.new_images += data

    def add_new_image(self, image):
        if image is None:
            return
        if image not in self.old_images:
            self.new_images.add(image)

    def add_new_images(self, images):
        if images is None or len(images) == 0:
            return
        for image in images:
            self.add_new_image(image)

    def has_new_image(self):
        return len(self.new_images) != 0

    # def get_new_image(self):
    #     new_image = self.new_images.pop()
    #     self.old_images.add(new_image)
    #     print(new_image)
    #     return new_image['title'], new_image['image']

    def get_new_image(self):
        new_image = self.new_images.pop()
        self.old_images.add(new_image)
        return new_image

    def get_count(self):
        return len(self.new_images)+len(self.old_images)
